
class Test{

    private int age;
    public int xh;
//


    //右键Generate 选get and set 自动生成权限私有的构造方法
    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void SetAge(int age){
        this.age=age;
    }
    public void SetXh(int xh){
        this.xh=xh;
    }
    public void Print(){
        System.out.println(age);
        System.out.println(xh);
    }

}
public class chap10 {
    //类加对象与封装
    public static void main(String[] args) {
        Test t1=new Test();
        t1.SetAge(10);
        t1.SetXh(200);
        t1.Print();

    }
}
